//
//  FKGoodsBannerCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/18.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKGoodsBannerCell.h"
#import <SDCycleScrollView.h>

@interface FKGoodsBannerCell ()

@property (nonatomic, weak) SDCycleScrollView *bannerView;
//@property (nonatomic, weak) UIView *activeView;
////@property (nonatomic, weak) UIButton *getPosterBtn;
//@property (nonatomic, weak) UILabel *timeLabel;
//@property (nonatomic, weak) UILabel *startLabel;

@end

@implementation FKGoodsBannerCell

- (void)setupSubviews
{
    [super setupSubviews];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    SDCycleScrollView *bannerView = [[SDCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, fkScreenW, fkScreenW * 0.5)];
    [self.contentView addSubview:bannerView];
    self.bannerView = bannerView;
    bannerView.placeholderImage = kPlaceholder_2x1;
    bannerView.currentPageDotColor = fkMainColor;
    bannerView.pageDotColor = [UIColor whiteColor];
    bannerView.bannerImageViewContentMode = UIViewContentModeScaleToFill;
    bannerView.autoScrollTimeInterval = 2.0;
    
//    UIButton *getPosterBtn = [UIButton fk_btnWithTarget:self action:@selector(getPosterBtnClicked:) font:fk_adjustFont(15) normalTitle:@"获取海报" normalTitleColor:[UIColor whiteColor] selectedTitle:nil selectedTitleColor:nil normalImg:nil selectedImg:nil bgImg:nil selectedBgImg:nil];
//    [self.contentView addSubview:getPosterBtn];
//    self.getPosterBtn = getPosterBtn;
//    [getPosterBtn fk_viewCornerRadius:fk_adjustW(12) borderWidth:0 borderColor:nil];
//    getPosterBtn.backgroundColor = fkColorAlpha(255, 46, 46, 0.6);
    
//    UIView *activeView = [[UIView alloc] init];
//    [self.contentView addSubview:activeView];
//    self.activeView = activeView;
//    activeView.backgroundColor = [UIColor fk_colorWithHex:0xFF2E2E];
//
//    UILabel *timeLabel = [UILabel fk_labelWithFont:fk_adjustFont(11) textColor:[UIColor whiteColor]];
//    [activeView addSubview:timeLabel];
//    self.timeLabel = timeLabel;
//
//    UILabel *startLabel = [UILabel fk_labelWithFont:fk_adjustFont(11) textColor:[UIColor whiteColor]];
//    [activeView addSubview:startLabel];
//    self.startLabel = startLabel;
    
    // 设置frame
//    [getPosterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.offset(fk_adjustW(12));
//        make.width.offset(fk_adjustW(98));
//        make.height.offset(fk_adjustW(24));
//        make.centerY.offset(0);
//    }];
//    [activeView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.bottom.right.offset(0);
//        make.height.offset(fk_adjustW(25));
//    }];
//    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.offset(10);
//        make.centerY.offset(0);
//    }];
//    [startLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.offset(-10);
//        make.centerY.equalTo(timeLabel);
//    }];
}

- (void)getPosterBtnClicked:(UIButton *)btn
{
    if ([self.delegate respondsToSelector:@selector(goodsBannerCell:didClickedGetPosterBtn:)]) {
        [self.delegate goodsBannerCell:self didClickedGetPosterBtn:btn];
    }
}

- (void)setData:(id)data
{
    [super setData:data];
    
    self.bannerView.imageURLStringsGroup = data[@"images"];
//    // 物流商品隐藏活动时间
//    self.activeView.hidden = [data[@"item_type"] isEqualToString:@"2"];
//
//    self.timeLabel.text = data[@"active_datestring_desc"];
//
//    self.startLabel.hidden = false;
//    if ([fkFORMAT(@"%@", data[@"sale_start_status"]) isEqualToString:@"0"]) { // 未开售
//        self.startLabel.text = fkFORMAT(@"开售时间: %@", [data[@"sale_start_time"] fk_timeWithFormat:@"yyyy-MM-dd HH:mm"]);
//    } else if ([fkFORMAT(@"%@", data[@"sale_start_status"]) isEqualToString:@"1"]) { // 已开售
//        self.startLabel.text = data[@"sale_start_name"];
//    }
    
//    self.getPosterBtn.hidden = [data[@"hidePostImg"] boolValue];
}

@end
